﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TychoTest.Evaluation {
    [TestClass]
    public class TestIntegerArithmetic {
        [TestMethod]
        public void TestPlus () {
            Script.Test (
@"1 + 2",

@"> 3");
        }
        
        [TestMethod]
        public void TestMinus () {
            Script.Test (
@"2 - 1",

@"> 1");
        }
        
        [TestMethod]
        public void TestMultiply () {
            Script.Test (
@"2 * 3",

@"> 6");
        }
        
        [TestMethod]
        public void TestDivide () {
            Script.Test (
@"7 / 2",

@"> 3");
        }

        [TestMethod]
        public void TestPlusReal () {
            Script.Test (
@"1 + 2.1",

@"> 3.1");
        }

        [TestMethod]
        public void TestMinusReal () {
            Script.Test (
@"5 - 3.5",

@"> 1.5");
        }

        [TestMethod]
        public void TestMultiplyReal () {
            Script.Test (
@"2 * 5.4",

@"> 10.8");
        }

        [TestMethod]
        public void TestDivideReal () {
            Script.Test (
@"3 / 2.5",

@"> 1.2");
        }

        [TestMethod]
        public void TestPlusString () {
            Script.Test (
@"4 + "" hero""",

@"> ""4 hero""");
        }

        
        [TestMethod]
        public void TestMultiplyString () {
            Script.Test (
@"4 * ""stars""",

@"> ""starsstarsstarsstars""");
        }

        [TestMethod]
        public void TestLessThan () {
            Script.Test (
@"4 < 6",

@"> true");
        }

        [TestMethod]
        public void TestLessThanReal () {
            Script.Test (
@"4 < 6.8",

@"> true");
        }
        
        [TestMethod]
        public void TestLessThanOrEqualTo () {
            Script.Test (
@"4 <= 4",

@"> true");
        }

        [TestMethod]
        public void TestGreaterThan () {
            Script.Test (
@"5 > 4",

@"> true");
        }

        [TestMethod]
        public void TestGreaterThanReal () {
            Script.Test (
@"5 > 4.3",

@"> true");
        }
        
        [TestMethod]
        public void TestGreaterThanOrEqualTo () {
            Script.Test (
@"5 >= 5",

@"> true");
        }
        
        [TestMethod]
        public void TestToPower () {
            Script.Test (
@"2 ^ 3",

@"> 8");
        }
        
        [TestMethod]
        public void TestToPowerReal () {
            Script.Test (
@"2 ^ 2.5",

@"> 5.65685424949238");
        }

    }
}
